<!DOCTYPE html>
<html>
  <head>
  	<title>GPin</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<meta charset="UTF-8">
	<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <style type="text/css" >
	@charset "utf-8";
	html { height: 100% }
	body { height: 100%;font-family: Verdana, Arial, Helvetica, sans-serif; }
	*{margin: 0; padding: 0}
	#map_canvas { height: 100% }
	/* This class is used to style the tooltip */
	.tooltip{
		border:thin 1px #eee;
		background-color:#FFFBF0;
		padding:5px;
		width:200px;
	}
	</style>
    <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE&sensor=false" type="text/javascript"></script>
    <script type="text/javascript" src="tooltip.js"></script>
    <script type="text/javascript">
	var places = Array();
	</script>
    <script type="text/javascript" src="places.php"></script>
    <script type="text/javascript">
	function createMap() 
	{
		var mapDiv = document.getElementById("map_canvas");
		var bound = new google.maps.LatLngBounds();
		var latlng =new google.maps.LatLng(0, 0);
		var myOptions = {
			zoom: 4, 
			center:  latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP				
		};
		var map = new google.maps.Map(mapDiv, myOptions);
		if(places.length)
		{
			for (var key in places)
			{
				var myPlace = places[key];
				if (myPlace.position) 
				{
					var marker = new google.maps.Marker({map: map, position: new google.maps.LatLng(myPlace.position.lat, myPlace.position.lng)});
					bound.extend(new google.maps.LatLng(myPlace.position.lat, myPlace.position.lng));
					createInfoWindow(marker, key);
					createTooltip(marker, key);							
				}
			}
			// Fit bounds and center to markers
			map.setCenter(bound.getCenter());		
			map.fitBounds(bound);
		}
	}
  </script>
  </head>
  <body onLoad="createMap();">
	<div id="map_canvas"></div>
  </body>
</html>